﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualBasic;
using Coldairarrow.Util;

namespace Coldairarrow.Entity.Interface
{
    /// <summary>
    /// 销售报告
    /// </summary>
    /// 
    public class StocksDTO
    {
        /// <summary>
        /// 物料代码
        /// </summary>
        public Stocks_data data { get; set; }

    }
    public class Stocks_data
    {
        public List<groups> groups { get; set; }
    }

    public class groups
    {
        /// <summary>
        /// 科目ID
        /// </summary>
        public string subjectID { get; set; }
        /// <summary>
        /// 主题名称	
        /// </summary>
        public string subjectName { get; set; }
        /// <summary>
        /// 品牌	
        /// </summary>
        public string brandName { get; set; }
        /// <summary>
        /// 标签ID	
        /// </summary>
        public string tagID { get; set; }
        /// <summary>
        /// 指标	
        /// </summary>
        public object metrics { get; set; }
        /// <summary>
        /// 库存产品信息	
        /// </summary>
        public List<WBStocks> items { get; set; }

    }
    public class WBStocks
    {
        public string ID { get; set; }
        public string RowId { get; set; }


        /// <summary>
        /// 产品ID
        /// </summary>
        public string nmID { get; set; }
        /// <summary>
        /// 是否删除
        /// </summary>
        public string isDeleted { get; set; }
        /// <summary>
        /// 主题名称
        /// </summary>
        public string subjectName { get; set; }
        /// <summary>
        /// 产品名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 产品编码
        /// </summary>
        public string vendorCode { get; set; }
        /// <summary>
        /// 品牌
        /// </summary>
        public string brandName { get; set; }
        /// <summary>
        /// 图片
        /// </summary>
        public string mainPhoto { get; set; }
        /// <summary>
        /// 商品有尺码
        /// </summary>
        public string hasSizes { get; set; }
        /// <summary>
        /// 指标信息
        /// </summary>
        public metrics metrics { get; set; }




        /// <summary>
        /// 订购数量
        /// </summary>
        public string ordersCount { get; set; }
        /// <summary>
        /// 订购金额
        /// </summary>
        public string ordersSum { get; set; }
        /// <summary>
        /// 平均每日订单数
        /// </summary>
        public string avgOrders { get; set; }
        /// <summary>
        /// 每月平均订单数		
        /// </summary>
        public List<object> avgOrdersByMonth { get; set; }
        /// <summary>
        /// 实际交易数量
        /// </summary>
        public string buyoutCount { get; set; }
        /// <summary>
        /// 实际交易金额
        /// </summary>
        public string buyoutSum { get; set; }
        /// <summary>
        /// 成交率
        /// </summary>
        public string buyoutPercent { get; set; }
        /// <summary>
        /// 库存数量
        /// </summary>
        public string stockCount { get; set; }
        /// <summary>
        /// 库存金额
        /// </summary>
        public string stockSum { get; set; }

        /// <summary>
        /// 库存周转率	
        /// </summary>
        //private string saleRate_;

        //public string saleRate
        //{

        //    get { return saleRate_; }

        //    set
        //    {
        //        if (!metrics.IsNullOrEmpty())
        //        {
        //            if (metrics.saleRate.hours == "-1") saleRate_ = "无限持续时间";
        //            else if (metrics.saleRate.hours == "-2") saleRate_ = "零持续时间";
        //            else if (metrics.saleRate.hours == "-3") saleRate_ = "未计算的持续时间";
        //            else if (metrics.saleRate.hours == "-4") saleRate_ = "整个期间内缺货";
        //            else saleRate_ = metrics.saleRate.days + "天" + metrics.saleRate.hours + "时";
        //        }
        //        else
        //        {
        //            saleRate_ = "0天0时";
        //        }
        //    }
        //}
        /// <summary>
        /// 库存周转率_持续天数		
        /// </summary>
        public string saleRate_days { get; set; }
        /// <summary>
        /// 库存周转率_持续小时		
        /// </summary>
        public string saleRate_hours { get; set; }


        /// <summary>
        /// 平均库存周转率	
        /// </summary>
        //public string avgStockTurnover { get; set; }
        /// <summary>
        /// 平均库存周转率_持续天数		
        /// </summary>
        public string avgStockTurnover_days { get; set; }
        /// <summary>
        /// 平均库存周转率_持续小时		
        /// </summary>
        public string avgStockTurnover_hours { get; set; }


        /// <summary>
        /// 运至客户数量
        /// </summary>
        //public string toClientCount { get; set; }
        /// <summary>
        /// 客户退回数量
        /// </summary>
        public string fromClientCount { get; set; }
        /// <summary>
        /// 缺货时间
        /// </summary>
        //public string officeMissingTime { get; set; }

        /// <summary>
        /// 缺货时间_持续天数		
        /// </summary>
        public string officeMissingTime_days { get; set; }
        /// <summary>
        /// 缺货时间_持续小时		
        /// </summary>
        public string officeMissingTime_hours { get; set; }


        /// <summary>
        /// 错失订单量
        /// </summary>
        public string lostOrdersCount { get; set; }
        /// <summary>
        /// 错失订单金额
        /// </summary>
        public string lostOrdersSum { get; set; }
        /// <summary>
        /// 错失赎回量
        /// </summary>
        public string lostBuyoutsCount { get; set; }
        /// <summary>
        /// 错失赎回金额
        /// </summary>
        public string lostBuyoutsSum { get; set; }
        /// <summary>
        /// 当前价格
        /// </summary>
        public object currentPrice { get; set; }
        /// <summary>
        /// 可用性
        /// </summary>
        public string availability { get; set; }

    }

    public class metrics
    {
        /// <summary>
        /// 订购数量
        /// </summary>
        public string ordersCount { get; set; }
        /// <summary>
        /// 订购金额
        /// </summary>
        public string ordersSum { get; set; }
        /// <summary>
        /// 平均每日订单数
        /// </summary>
        public string avgOrders { get; set; }
        /// <summary>
        /// 每月平均订单数		
        /// </summary>
        public List<object> avgOrdersByMonth { get; set; }
        /// <summary>
        /// 实际交易数量
        /// </summary>
        public string buyoutCount { get; set; }
        /// <summary>
        /// 实际交易金额
        /// </summary>
        public string buyoutSum { get; set; }
        /// <summary>
        /// 成交率
        /// </summary>
        public string buyoutPercent { get; set; }
        /// <summary>
        /// 库存数量
        /// </summary>
        public string stockCount { get; set; }
        /// <summary>
        /// 库存金额
        /// </summary>
        public string stockSum { get; set; }
        /// <summary>
        /// 库存周转率
        /// </summary>
        public ageData saleRate { get; set; }
        /// <summary>
        /// 平均库存周转率
        /// </summary>
        public ageData avgStockTurnover { get; set; }
        /// <summary>
        /// 运至客户数量
        /// </summary>
        public string toClientCount { get; set; }
        /// <summary>
        /// 客户退回数量
        /// </summary>
        public string fromClientCount { get; set; }
        /// <summary>
        /// 缺货时间
        /// </summary>
        public ageData officeMissingTime { get; set; }
        /// <summary>
        /// 错失订单量
        /// </summary>
        public string lostOrdersCount { get; set; }
        /// <summary>
        /// 错失订单金额
        /// </summary>
        public string lostOrdersSum { get; set; }
        /// <summary>
        /// 错失赎回量
        /// </summary>
        public string lostBuyoutsCount { get; set; }
        /// <summary>
        /// 错失赎回金额
        /// </summary>
        public string lostBuyoutsSum { get; set; }
        /// <summary>
        /// 当前价格
        /// </summary>
        public object currentPrice { get; set; }
        /// <summary>
        /// 可用性
        /// </summary>

        private string _availability;
        public string availability
        {
            get { return _availability; }

            set
            {
                if (value == "deficient") _availability = "库存不足";
                else if (value == "actual") _availability = "卖得好";
                else if (value == "balanced") _availability = "稳定销售";
                else if (value == "nonActual") _availability = "销售不佳";
                else if (value == "nonLiquid") _availability = "滞销商品";
                else if (value == "invalidData") _availability = "未计算";
                else _availability = value;
            }

        }


    }

    public class ageData
    {

        /// <summary>
        /// 持续天数		
        /// </summary>
        public string days { get; set; }
        /// <summary>
        /// 持续小时		
        /// </summary>
        public string hours { get; set; }


    }

}
